package com.wsb;

//import com.mysql.cj.result.SqlDateValueFactory;
import com.wsb.dao.SmbmsUserDao;
import com.wsb.entry.SmbmsUser;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

public class MainTest {
    public static void main(String[] args ){
        String config ="mybatis-config.xml";
        try {
            InputStream inputStream= Resources.getResourceAsStream(config);
            SqlSessionFactoryBuilder sqlSessionFactoryBuilder=new SqlSessionFactoryBuilder();
            SqlSessionFactory sqlDateValueFactory=sqlSessionFactoryBuilder.build(inputStream);
            SqlSession sqlsession=sqlDateValueFactory.openSession();
            SmbmsUserDao smbmsUserDao=sqlsession.getMapper(SmbmsUserDao.class);
            SmbmsUser smbmsUser =smbmsUserDao.getSmbmsUserCode("admin");
            System.out.println(smbmsUser);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
